﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SayHere
{
    public partial class TeacherManagement : UserControl
    {
        SayHereEntities _sayHereEntities = null;

        public TeacherManagement()
        {
            InitializeComponent();
            _sayHereEntities = new SayHereEntities();
            dataGridViewManagement.DataSource = _sayHereEntities.Teacher;
            foreach (DataGridViewTextBoxColumn col in dataGridViewManagement.Columns)
            {
                //hide ID columns
            //    if (col.Name.EndsWith("ID"))
            //        dataGridViewManagement.Columns[col.Name].Visible = false;
            }

        }

        private void buttonSave_Click(object sender, EventArgs e)
        {

            try
            {
                int result = _sayHereEntities.SaveChanges();
                MessageBox.Show(result.ToString() + " Updates Successful");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonAdd_Click(object sender, EventArgs e)
        {
            
        }
    }
}
